using System;
using System.IO;
using System.Collections.Generic;
using System.Text;
using System.Xml;

namespace stsdev
{
    public class ActivityActionsFileBuilder
    {
        private static string sActionsFolder = Globals.RootFilesFolder + @"\TEMPLATE\1033\Workflow";


        public static void CreateActionsFile(string sActivityName)
        {
            EnsureActionsFolder();
            string ActionSourceFilePath = sActionsFolder + @"\" + sActivityName + ".ACTIONS";
 
            #region ActivitySourceFilePath
            FileStream fs = File.Create(ActionSourceFilePath);
            StreamWriter writer = new StreamWriter(fs);
            string content = WFActivitySolutionProvider.Properties.Resources.Activity_ACTIONS;
            content = content.Replace("@SolutionName", SolutionBuilder.SolutionName);
            content = content.Replace("@ClassName", sActivityName);
            content = content.Replace("@FullAssemblyName", SolutionBuilder.FullAssemblyName);
            writer.Write(content);
            writer.Dispose();
            fs.Dispose();
            ProjectFileBuilder.AddSourceFile(ActionSourceFilePath,SourceFileTypeEnum.Content);
            #endregion

  
        }

        private static void EnsureActionsFolder()
        {
            if (!Directory.Exists(sActionsFolder))
            {
                Directory.CreateDirectory(sActionsFolder);
            }
        }
    }
}

